package org.jawp.persistence;

public class Product implements Content{
	
	// members
	private final int id;
	private String name;
	private int categoryId;
	
	// constructors
	public Product(int id, String name, int categoryId) {
		super();
		this.id = id;
		this.name = name;
		this.categoryId = categoryId;
	}
	
	// getters
	
	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public int getCategoryId() {
		return categoryId;
	}
	
	// setters
	
	public void setName(String newName) {
		this.name= newName ;
	}

	public void setCategory(int newCategory) {
		this.categoryId = newCategory;
	}
	
	// generic methods
	
	@Override
	public String toString() {
		return "Product named "+name+" (id = "+id+")";
	}

	@Override
	public boolean equals(Object obj) {
		if( (obj instanceof Product) && (this.id == ((Product)obj).id))
			return true;
		return false;
	}
}
